var MaterialDetail = function () {
  var template = /* html */ `
    <div class="material-form">
      <el-form label-width="120px" size="medium">
        <el-form-item :label="isCustomer?'产品代码':'物料代码'">
          <span>{{materialData.materialCode}}</span>
        </el-form-item>
        <el-form-item :label="isCustomer?'产品名称':'物料名称'">
          <span>{{materialData.materialName}}</span>
        </el-form-item>
        <el-form-item :label="isCustomer?'产品图片':'物料图片'">
          <imgs-upload readonly v-model="materialData.imgUrls"></imgs-upload>
        </el-form-item>
        <el-form-item label="规格型号">
          <span>{{materialData.model}}</span>
        </el-form-item>
        <el-form-item label="编号">
          <span>{{materialData.color}}</span>
        </el-form-item>
        <el-form-item label="描述">
          <span>{{materialData.colorDescription}}</span>
        </el-form-item>
        <el-form-item :label="isCustomer?'产品部门':'物料部门'">
          <span>{{materialData.materialDept!==''?materialData.materialDept.materialDeptName:''}}</span>
        </el-form-item>
        <el-form-item label="材质">
          <span>{{materialData.material}}</span>
        </el-form-item>
        <el-form-item label="状态">
          <span>{{materialData.status}}</span>
        </el-form-item>
        <el-form-item label="默认仓库">
          <span>{{i18n.getMsg('spotMaterial.defaultWarehouse.'+materialData.defaultWarehouse)}}</span>
        </el-form-item>
        <el-form-item :label="isCustomer?'产品类型':'物料类型'">
          <span>{{materialData.materialType}}</span>
        </el-form-item>
        <template v-if="materialData.defaultWarehouse===1 && materialData.materialType==='镜片'">
          <span>{{materialData.transmittance}}</span>
        </template>
        <el-form-item label="供应商" v-if="!isCustomer">
          <span>{{materialData.providerName}}</span>
        </el-form-item>
        <el-form-item label="供方编号">
          <span>{{materialData.providerNo}}</span>
        </el-form-item>
        <el-form-item label="单位">
          <span>{{materialData.unit}}</span>
        </el-form-item>
        <el-form-item label="单价">
          <span>{{materialData.unitPrice}}</span>
        </el-form-item>

        <template v-if="!isCustomer">
        <el-form-item class="input-item" label="计价单位与生产单位是否相同">
          <span>{{materialData.unit==='付'?'相同':'不相同'}}</span>
        </el-form-item>
        <el-form-item label="采购周期">
          <span>{{materialData.procurementCycles}}</span>
        </el-form-item>
        <el-form-item label="库存上限">
          <span>{{materialData.safetyStockMax}}</span>
        </el-form-item>
        <el-form-item label="库存下限">
          <span>{{materialData.safetyStockMin}}</span>
        </el-form-item>
        <el-form-item label="创建人">
          <span>{{materialData.creater}}</span>
        </el-form-item>
        <el-form-item label="创建时间">
          <span>{{materialData.creationTime}}</span>
        </el-form-item>
        <el-form-item label="最后修改人">
          <span>{{materialData.lastModifier}}</span>
        </el-form-item>
        <el-form-item label="最后修改时间">
          <span>{{materialData.lastModifyTime}}</span>
        </el-form-item>
        </template>
      </el-form>
    </div>
  `;

  return {
    props: {
      material: {
        type: Object,
        required: true
      },
      isCustomer: {
        type: Boolean,
        default: false
      }
    },

    data: function () {
      return {
        materialData: new SpotMaterialModel(this.material)
      };
    },

    components: {
      ImgsUpload: ImgsUpload
    },

    template: template
  };
}();
